#ifndef __INPUT_MANAGER_HPP__
#define __INPUT_MANAGER_HPP__

#include <vector>
#include <map>
#include "InputEventListener.hpp"
#include "InputEvent.hpp"

class InputEventListener;

typedef enum eKeyPressStatus
{
	KEY_PRESSED,
	KEY_RELEASED

} KEY_STATUS;

class InputManager
{
public:
	static void    createInstance();
	static void    destroyInstance();

    static void    receiveMouseActiveEvent(); //unfinished
	static void    receiveMousePassiveEvent(); //unfinished
	static void    receiveKeyboardPress(unsigned char key, int x, int y);
	static void    receiveKeyboardRelease(unsigned char key, int x, int y);
	static void    receiveKeyboardSpecialPress(int key, int x, int y);
	static void    receiveKeyboardSpecialRelease(int key, int x, int y);

	static InputManager*  getInstance();
	
	void         registerListener(InputEventListener* pListener, EVENT_TYPE eListenedType);
	void         resetKeysMap();
	KEY_STATUS   lookUpKeyStatus(int iKeyCode);

private:
	InputManager();
	~InputManager();
	void propagateEvent(InputEvent* pEvent);
	int  translateSpecialKey(int iKeyCode);

	static InputManager* m_pInstance;

	std::vector<InputEventListener*> m_keybrdListeners;
	std::vector<InputEventListener*> m_mouseListeners;
	std::map<int, KEY_STATUS>        m_keysMap;
};

#endif //__INPUT_MANAGER_HPP__

//EOF
